package com.xs.designs.strategy.di;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class PayController {

    @Autowired
    PaymentStrategyFactory paymentStrategyFactory;

    // 支付
    @RequestMapping("pay")
    public void pay(int payType, double amount) {
        paymentStrategyFactory.getPayment(PayEnum.fromValue(payType))
                .pay(amount);
    }


}
